Cross Belt Sorter

Properties

Name Type Description
ProductCount Integer Gets the number of products currently on the cross belt sorter
Running Boolean DEPRECATED - Gets/Sets the running state of the sorter
StartStopRequest Boolean New in V7.22. Gets/Sets the Cross Belt Sorter to start or stop. When AccelerationEnabled is true Cross Belt Sorter will start stop gradually using acceleration/deceleration)
AccelerationEnabled Boolean New in V7.22. Gets/Sets AccelerationEnabled.
Acceleration Number New in V7.22. Gets/Sets the Cross Belt Sorter’s acceleration value in the units chosen when the project was created (metres or feet) / second squared. Cannot be zero
Deceleration Number New in V7.22. Gets/Sets the Cross Belt Sorter’s deceleration value in the units chosen when the project was created (metres or feet) / second squared. Cannot be zero
UseAccelerationInTimeMode Boolean New in V8.3. Default is true i.e 'Use Time (in seconds)'. Allows the selection of the acceleration time in Speed/Time or a simple time in seconds to reach the speed.
AccelerationInSeconds Number New in V8.3. Gets/Sets the simple acceleration time in seconds to reach the speed
DecelerationInSeconds Number New in V8.3. Gets/Sets the simple deceleration time in seconds to reach the speed
TargetSpeed Number Gets/Sets the speed of the Cross Belt Sorter while running
CurrentBelt Integer Gets the Belt Index of the belt that just passed a PE Sensor. See note at the bottom of the page
BaseColor String New in V7.0. Gets/Sets the name of the color of the base
IslandsColor String New in V7.0. Gets/Sets the name of the color of the islands
BeltsColor String New in V7.0. Gets/Sets the name of the color of the belts
BaseVisible Boolean New in V7.0. Gets/Sets the visibility of the base
IslandsVisible Boolean New in V7.0. Gets/Sets the visibility of the islands
BeltsVisible Boolean New in V7.0. Gets/Sets the visibility of the belts
EncoderEnabled Boolean New in V7.23. Gets/Sets to enable the calculation of DistanceTravelled by transporter
DistanceTravelled Number New in V7.23. Gets the distance travelled by the transporter since the simulation is started, measured in millimeter for metric(metres) and inches for imperial(feet) units
MaxDistanceTravelled Number New in V8.0. Gets/Sets Max value for distance Travel by the transporter in the currently defined system units

Events

OnSorterRunningStateChange

Invoked when the running state of the Cross Belt Sorter is changed

Callback Signature

void xxxxxxxxxxxxxxxxx(sender: object);

 

Name Type Description
sender Object The object associated with the changed property

OnCurrentBeltChange

Invoked when the currentBelt property of the Cross Belt Sorter is changed

Callback Signature

void xxxxxxxxxxxxxxxxx(sender: object);

 

Name Type Description
sender Object The object associated with the changed property

OnProductAdded

Invoked when a product is added to the cross belt sorter

Note: This event does not support multiple subscription. Previous subscription will be lost if subscribe twice.

Callback Signature

void xxxxxxxxxxxxxxxxx(sender: object, product: Product, source: object, beltIndex: integer);

 

Name Type Description
sender Object The object associated with the changed property
product Product The added product
source Object The object from which the product is coming
beltIndex Integer The belt index which the product is added to. See note at the bottom of the page

OnProductRemoved

Invoked when a product is removed from the cross belt sorter

Note: This event does not support multiple subscription. Previous subscription will be lost if subscribe twice.

Callback Signature

void xxxxxxxxxxxxxxxxx(sender: object, product: Product, exit: object, beltIndex: integer);

 

Name Type Description
sender Object The object associated with the changed property
product Product The removed product
exit Object The object to which the product is transferred
beltIndex Integer The belt index from which the product is removed. See note at the bottom of the page

OnProductReachExit

Invoked when a product has reached the exit point, but has not been removed yet

Note: This event does not support multiple subscription. Previous subscription will be lost if subscribe twice.

Callback Signature

void xxxxxxxxxxxxxxxxx(sender: object, product: Product, exit: object);

 

Name Type Description
sender Object The object associated with the changed property
product Product The product that is going to be transferred
exit Object The object to which the product should be transferred

OnProductFailToExit

Invoked when a product tried to exit but failed to do so. ie Exit chute is full.

Note: This event does not support multiple subscription. Previous subscription will be lost if subscribe twice.

Callback Signature

void xxxxxxxxxxxxxxxxx(sender: object, product: Product, exit: object, reasonCode: integer);

 

Name Type Description
sender Object The object associated with the changed property
product Product The product that should have been transferred
exit Object The object to which the product should have been transferred
reasonCode Integer The reason for which the product failed to exit.
0 = Chute is full, 1 = Consecutive trays.

Functions

void SetSorterPosition(beltIndex: integer, distance: double);

Called to adjust the sorter position to synchronize it to a known point

Name Type Description
beltIndex Integer The index number of the belt to align at the distance indicated by the 'position' parameter. See note at the bottom of the page.
position double The distance from the start of the sorter(metres)

Return value - void

Array GetCurrentSpeed()

New in V8.3. Gets the current speed. Can be used during acceleration/deceleration

Return value - (double) current speed value in the units chosen when project was created

 

void InductProduct(product: Product, beltIndex: integer);

Called to add a product item to the sorter on a specific belt

Name Type Description
product Product Product object to add to the sorter
beltIndex Integer Index of the belt that the product will be placed on. See note at the bottom of the page.

Return value - void. The function call will fail to add a product on the cell if the specified cell is already occupied or the beltIndex value is invalid. It is the user's responsibility to check the cell is free (GetProductOnBelt) before inducting.

 

The user can pass zero as the argument for product, in this case the sorter will automatically create product on the specified cell as long as the cell is not occupied and valid.

integer GetProductOnBelt(beltIndex: integer);

Called to return the product objectId from a specific belt of the sorter if it exists

Name Type Description
beltIndex Integer The index number of the belt to return any product from. See note at the bottom of the page.

Return value - integer objectId. The return value may be zero if no product is found

integer blockHandle SubscribeOnBeltBlocking(callback: function, block distance: double);

Called to subscribe the belt blocking event, if the belt block/detect at given distance, the callback function gets execute

Name Type Description
callback function The callback function which need to execute when belt block.
distance double The distance that belt get block/detect. The distance should measure from sorter initial point.

Return value - integer blockhandle. The blockhandle can be use to unsubscribe blocking events.

Callback Signature

void xxxxxxxxxxxxxxxxx(sender: object, belt Index: integer, product: Product)

 

Name Type Description
sender Object The object associated with the subscribe blocking event.
belt Index Integer The index of the belt which get block/detect.
product Product The product object if the belt carried it or can be null (if empty).

integer SubscribeOnBeltUnblocking(callback: function, block distance: double);

Called to subscribe the belt unblocking event, if the belt unblock/pass over at given distance, the callback function gets execute

Name Type Description
callback function The callback function which need to execute when belt block.
distance double The distance that belt get unblock. The distance should measure from sorter initial point.

Return value - integer unblockHandle. The unblockHandle can be use to unsubscribe unblocking events.

Callback Signature

void xxxxxxxxxxxxxxxxx(sender: object, belt Index: integer, product: Product)

 

Name Type Description
sender Object The object associated with the subscribe unblocking event.
belt Index Integer The index of the belt which get unblock/pass over.
product Product The product object if the belt carried it or can be null (if empty).

bool UnsubscribeOnBeltBlocking(blockHandle: integer);

Called to unsubscribe the previously created belt blocking event

Name Type Description
blockHandle integer The handle which belt block to be remove.

Return value - bool. The value will be true if remove block successfully.

bool UnsubscribeOnBeltUnblocking(blockHandle: integer);

Called to unsubscribe the previously created belt unblocking event

Name Type Description
unblockHandle integer The handle which belt unblock to be remove.

Return value - bool. The value will be true if remove unblock successfully.

Example script:

var cbs;
var handle1;
var handle2;
var count = 0;
var count1 = 0;

function OnSimulationStart() {

    cbs = GetComponentByNameAndType("CrossBeltSorter1", "Cross Belt Sorter");
    handle1 = cbs.SubscribeOnBeltBlocking(OnBeltBlockingCallBack_Position1, 5.6);
    handle2 = cbs.SubscribeOnBeltUnblocking(OnBeltUnblockingCallBack_Position1, 5.6);
}

function OnBeltBlockingCallBack_Position1(sender, beltIndex, product) {
			
    if(product != null) count++;
    if(count == 8) UnsubscribeBlocking(handle1);
}

function OnBeltUnblockingCallBack_Position1(sender, beltIndex, product) {
			
    if(product != null) count1++;
    if(count1 == 12) UnsubscribeUnblocking(handle2);
}
			
function UnsubscribeBlocking(handle) {
			
    cbs.UnsubscribeOnBeltBlocking(handle);
}

function UnsubscribeUnblocking(handle) {
			
    cbs.UnsubscribeOnBeltUnblocking(handle);
}
		

void RemoveProduct(beltIndex: integer, target: object);

Called to remove product from the sorter on a specific belt

Name Type Description
beltIndex Integer The index number of the belt that product will be removed from. See note at the bottom of the page.
target Object The destination equipment object to move the product to. Can be null.

Return value - void

Example:

var sorter = GetComponentByNameAndType("Sorter1", "Cross Belt Sorter");
var conveyor = GetComponentByNameAndType("Conveyor1", "Conveyor");

sorter.RemoveProduct(2, null); // just remove the product
sorter.RemoveProduct(3, conveyor); // remove the product and induct it on an equipment

void ReInstateProduct(beltIndex: integer);

Called to replace product on a specific belt

Name Type Description
beltIndex Integer The index number of the belt that product will placed on. The product will be the product item that was last on the belt, if it still exists, or a new product item

Return value - void

Void RemoveAllProduct();

Called to remove all the product items from the sorter

Return value - void

Note

All belts are identified on the sorter by an index number. This number is derived as follows:

beltIndex = Displayed belt number - 1

See image below: